<!DOCTYPE html>
<html lang="en" xmlns:v-bind="http://www.w3.org/1999/xhtml"
      xmlns:v-on="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>销售0级列表</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-store, must-revalidate">
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
    <meta http-equiv="expires" content="-1">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
          name="viewport">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="/dist/img/icon.png" type="image/x-icon">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="/dist/plugins/bootstrap/css/bootstrap.min.css">
    <!--字体-->
    <link rel="stylesheet" href="/dist/css/font-awesome.min.css">
    <!--图标-->
    <link rel="stylesheet" href="/dist/css/ionicons.min.css">
    <!--插件样式-->
    <link rel="stylesheet" href="/dist/plugins/select2/select2.min.css">
    <!--OA主样式-->
    <link rel="stylesheet" href="/dist/css/OA.min.css?t=39cd89cd">
    <link rel="stylesheet" href="/dist/css/skins/OA-skins.min.css?t=16f1e6f3">
    <style>
        .table>tbody>tr>td{
            height: 35px;
            max-height: 44px;
            overflow: hidden;
        }
        span.lineOne {
            line-height: 28px;
            height: 28px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
        }
    </style>
</head>
<body>
<section class="content" id="app">
    <iframe id="ifExprot" style="width:0px;height:0px;display: none;" frameborder="0"></iframe>
    <div class="div-td-content-more"><i></i></div>
    <div class="box-body no-padding iframeH2" style="overflow: auto;" id="scrollDiv">
        <div id="progress" class="wyui-progress"></div>
        <table class="table table-hover text-center table-striped">
            <thead>
            <tr>
                <th style="width: 37px" class="tableTitle">序号</th>
                <th style="width: 80px" class="tableTitle">公司</th>
                <th style="width: 75px" class="tableTitle">交车日期</th>
                <th style="width: 120px" class="tableTitle">合同编号</th>
                <th style="width: 45px" class="tableTitle">区域</th>
                <th style="width: 61px" class="tableTitle">区域经理</th>
                <th style="width: 61px;" class="tableTitle">客户名称</th>
                <th style="width: 61px" class="tableTitle">品牌</th>
                <th style="width: 61px" class="tableTitle">设备类型</th>
                <th style="width: 99px" class="tableTitle">型号</th>
                <th style="width: 80px" class="tableTitle">序列号</th>
                <th style="width: 83px" class="tableTitle">销售价格(元)</th>
                <th style="width: 61px" class="tableTitle">以旧换新</th>
                <th style="width: 75px" class="tableTitle">付款方式</th>
                <th style="width: 61px" class="tableTitle">是否结清</th>
                <th style="width: 61px" class="tableTitle">是否逾期</th>
               <!-- <th >操作</th>-->
            </tr>
            </thead>
            <tbody id="tbList">
            <tr v-for="(item,i) in list">
                <td>{{i+1}}</td>
                <td>{{item.seller}}</td>
                <td>{{item.deliveryDate}}</td>
                <td><span style="color:#2a8cec;cursor: pointer;" @click="goDetail('look',i)">{{item.contractNo=='-'?'查看':item.contractNo}}</span></td>
                <td>{{item.regionName}}</td>
                <td>{{item.regionManagerName}}</td>
                <td>{{(item.buyer).substring(0,3)}}</td>
                <td>{{item.brandName}}</td>
                <td>{{item.deviceType}}</td>
                <td>{{item.modelName}}</td>
                <td >{{(item.serialNo).substring(0,10)}}</td>
                <td>{{fmoney(item.salesPrice)}}</td>
                <td>{{item.haveReplacement==1?'是':'否'}}</td>
                <td class="td-tanZongStyle-line">{{item.buyType}}</td>
                <td>{{item.haveSettle=='1'?'是':'否'}}</td>
                <td>{{item.haveOverdue==1?'是':'否'}}</td>
                <!--<td>
                    &lt;!&ndash; <a href="javascript:void(0);" @click="gotoDetail(item.id,'browser')">&nbsp;查看&nbsp;</a>&ndash;&gt;
                    <a href="javascript:void(0);" @click="goDetail('edit',i)" v-if="isShowBtn('salesAccountEdit')">&nbsp;编辑&nbsp;</a>
                    <a href="javascript:void(0);" v-else style="color:#ddd;cursor: no-drop">&nbsp;编辑&nbsp;</a>
                </td>-->
            </tr>
            </tbody>
        </table>
        <!--<div class="oa-pager text-center" style="margin-top: 5px;">
            共
            <span id="allCount"> 0 </span>条记录&nbsp;&nbsp;&nbsp;
            <span id="nowPage"> 1 </span>/<span id="allPage">1</span>&nbsp;&nbsp;&nbsp;
            <span class="oa-pager-button" id="first">首页</span>
            <span class="oa-pager-button" id="prev">上一页</span>
            <span class="oa-pager-button" id="next">下一页</span>
            <span class="oa-pager-button" id="last">尾页</span>
        </div>-->
    </div>
</section>
<!--JQ-->
<script src="https://file.ggxqce.com/web/jquery-2.2.3.min.js"></script>
<!--插件JS-->
<script src="https://file.ggxqce.com/web/bootstrap.min.js"></script>
<!--框架已定义 JS-->
<script src="/dist/js/app_iframe.js?t=7e54a132"></script>
<!--oa自定义  JS-->
<script src="/dist/js/oa.js?t=558d0414"></script>
<script src="https://file.ggxqce.com/web/vue.min.js"></script>
<script src="/dist/plugins/select2/select2.full.min.js"></script>
<script type="text/javascript" src="/dist/plugins/lhgdialog/lhgdialog.min.js?self=true"></script>
<script>
    $(function () {
        $("body").on("click", ".lineOne,.lineTwo", function (e) {
            if ($(".div-td-content-more").is(":hidden")) {
                var text = $(this).text();
                if (text != "") {
                    text = "<i></i>" + text;
                    $(".div-td-content-more").html(text).css({
                        "width": $(this).outerWidth() + 12 + "px",
                        "left": $(this).offset().left - 6,
                        "top": ($(this).offset().top + $(this).outerHeight()) + "px"
                    }).show();
                    e.stopPropagation();
                }
            } else {
                $(".div-td-content-more").hide();
            }
        });
        $("body").on("click", ".div-td-content-more", function (e) {
            e.stopPropagation();
        });
        $("body").on("click", function () {
            $(".div-td-content-more").hide();
        });
    });
</script>
<script type="text/javascript">
    function refresh() {
        $.wyui.page.getByPage();
    }
    var app = new Vue({
        el: '#app',
        data: {
            companyId: $.wyui.page.urlParams.companyId,
            dateTime:$.wyui.page.urlParams.dateTime,
            rightOp: [],//权限列表
            companyList: [],
            searchParams: {
                userId: $.wyui.page.urlParams.userId ? $.wyui.page.urlParams.userId : getCurrentUser().id,
                customerKeyId: '',
                createUserId: '',
                customerKey: '',
                createUserName: '',
                auditFlag: '',
                haveSettle: 0,
                serialNo: '',
                selectCom: ""
            },
            searchParamsAll: {
                userId: $.wyui.page.urlParams.userId ? $.wyui.page.urlParams.userId : getCurrentUser().id,
                haveSettle:''
            },
            currentUser: getCurrentUser(),
            list: {

            },
        },
        methods: {
            isShowBtn: function (eName) {
                if (getCurrentUser().superUser || ($.inArray(eName, this.rightOp) > -1)) {
                    return true;
                } else {
                    return false;
                }
            },
            checkedOne:function (item) {
                if (this.selectId == item.id) {
                    // 如果已经包含了该id, 则去除(单选按钮由选中变为非选中状态)
                    this.selectId=""
                } else {
                    // 选中该checkbox
                    this.selectId= item.id
                }

                console.log(item);
            },
            goDetail: function (type, i) {
                top.closeTabByPageId("contractDetail");
                var that = this;
                var id = that.list[i].id;
                var buyType = that.list[i].buyType;
                var condition = '?id=' + id+ '&buyType=' + buyType;
                if (type == 'look') {
                    condition += '&pageType=look';
                    top.addTabs({
                        id: 'salesAccount',
                        title: '销售台账详情页',
                        close: true,
                        url: 'apply/salesAccount/detail.html'+condition
                    });
                    /*var H = $(window).height() - 50;
                     top.$.dialog({
                     content: 'url:/page/apply/salesAccount/detail.html' + condition ,
                     title: '销售台账详情页',
                     width: 904,
                     height: H,
                     max: false,
                     min: false,
                     lock: true
                     });*/
                }
                if(type == 'edit'){
                    condition += '&pageType=edit';
                    top.addTabs({
                        id: 'salesAccount',
                        title: '销售台账详情页',
                        close: true,
                        url: 'apply/salesAccount/detail.html'+condition
                    });
                    /*var H = $(window).height() - 50;
                     top.$.dialog({
                     content: 'url:/page/apply/salesAccount/detail.html' + condition ,
                     title: '销售台账详情页',
                     width: 904,
                     height: H,
                     max: false,
                     min: false,
                     lock: true
                     });*/
                }
            },
            search: function () {
                $.wyui.page.queryParams.requestPage = 1;
                $.extend($.wyui.page.queryParams, this.searchParams);
                console.log($.wyui.page.queryParams);
                $.wyui.page.getByPage();
            },
            searchAll: function () {
                $.wyui.page.queryParams.requestPage = 1;
                $.extend($.wyui.page.queryParams,this.searchParamsAll);
                console.log($.wyui.page.queryParams);
                $.wyui.page.getByPage();
            },
            fmoney: function (s, n) {
                n = n > 0 && n <= 20 ? n : 2;
                s = parseFloat((s + "").replace(/[^\d\.-]/g, "")).toFixed(n) + "";
                var l = s.split(".")[0].split("").reverse(), r = s.split(".")[1],
                    t = "";
                for (i = 0; i < l.length; i++) {
                    t += l[i] + ((i + 1) % 3 == 0 && (i + 1) != l.length ? "," : "");
                }
                return t.split("").reverse().join("") + "." + r;
            }
        },
        mounted: function () {
            var that = this;
            $.wyui.postMethod(urlConfig.contract.selectSales0NewList, {companyId:that.companyId,dateTime:that.dateTime}, function (r) {
             console.log(r);
                that.list= r.records;
             });
            //查询用户有哪些权限
           /* $.wyui.postMethod(urlConfig.system.rightOp.getRightOpByUserId, {userId: getCurrentUser().id}, function (rightOp) {
                for (var i = 0; i < rightOp.length; i++) {
                    that.rightOp.push(rightOp[i].eName);
                }

                console.log("权限列表如下：")
                console.log(that.rightOp);
            });*/

        }
    });
</script>
</body>
</html>